<!--
 * @Description: 会议查询
 * @Author: Chenx
 * @Date: 2023-04-10 14:10:15
 * @LastEditors: Chenx
 * @LastEditTime: 2023-04-17 18:07:51
-->
<script lang="ts" setup>
import BaseSearch from '@/components/common/BaseSearch.vue'
import { t } from '@/locales/tool'
// import { getTestData } from '@/apis/test'
// import { t } from '@/locales/tool'
const tableInfo = ref({
  tableColumnList: [
    {
      prop: 'name',
      label: '会议模板名称'
    },
    {
      prop: 'localtion',
      label: '会议地点'
    },
    {
      prop: 'status',
      label: '会议状态'
    },
    {
      prop: 'object',
      label: '所属对象'
    },
    {
      prop: 'time',
      label: '时长'
    }
  ],
  tableData: [] as Array<object>,
  pageNum: 1,
  pageSize: 10,
  multiple: true,
  loading: false,
  dataTotal: 0
})

const selectList = ref<string[]>([])
onMounted(() => {
  tableInfo.value.loading = true
  setTimeout(() => {
    tableInfo.value.loading = false
    tableInfo.value.tableData = [
      {
        name: '会话模板1',
        localtion: '地点一',
        status: '启用',
        object: '销售',
        time: '15分钟'
      },
      {
        name: '会话模板1',
        localtion: '地点一',
        status: '启用',
        object: '销售',
        time: '15分钟'
      },
      {
        name: '会话模板1',
        localtion: '地点一',
        status: '启用',
        object: '销售',
        time: '15分钟'
      },
      {
        name: '会话模板1',
        localtion: '地点一',
        status: '启用',
        object: '销售',
        time: '15分钟'
      },
      {
        name: '会话模板1',
        localtion: '地点一',
        status: '启用',
        object: '销售',
        time: '15分钟'
      },
      {
        name: '会话模板1',
        localtion: '地点一',
        status: '启用',
        object: '销售',
        time: '15分钟'
      }
    ]
    tableInfo.value.dataTotal = 6
  }, 1000)
  // getTestData({
  //   affiliation: '02,01',
  //   id: '',
  //   operationType: '1',
  //   roomCode: '',
  //   userName: '',
  //   roomName: '111',
  //   fullRoomName: '九龙观塘111',
  //   locationCode: '01',
  //   state: '0',
  //   capacity: '3',
  //   effectiveTime: '2023/04/14 17:12:13',
  //   expiryTime: '2023/04/15 17:12:14',
  //   remark: '444'
  // }).then().catch()
})
// 复选框选中--获取选中项方法
const handleSelectionChange = (listSelect: []) => {
  selectList.value = []
  console.log('listSelect:', listSelect)
  // MessageListVo: 出参接口类型
  // listSelect.forEach((item: MessageListVo) => {
  //   selectList.push(item.id as string)
  // })
}
// 头部搜索条件组件相关数据开始--------------------
interface selectVo {
  name: string,
  code: string
}
interface formItem {
  label?: string,
  type: string,
  selectOptions?: Array<selectVo>,
  param: string,
  defaultSelect?: string,
  reserve?: string
}
interface NObject {
  [key: string]: string
}
const formItemList = ref<formItem[]>([
  {
    label: t('common.goodsNo'),
    type: 'input',
    param: 'goodsCode'
  },
  {
    label: '标识 :',
    type: 'select',
    param: 'tagCode',
    selectOptions: [{ name: '热销', code: 'hot' }],
    defaultSelect: 'hot'
  },
  {
    label: '預約日期 :',
    type: 'rangeDate',
    param: 'orderDate'
  },
  {
    label: '預約日期 :',
    type: 'phone',
    param: 'phoneNumber',
    reserve: 'areaCode'
  }
])
const search = (form: NObject) => {
  console.log(form)
  // this.table.currentPage = 1
  // this.serviceCode = form.serviceCode
  // this.serviceName = form.serviceName
  // this.getInfoList()
  // this.selectArray = []
  // this.$refs.tableBox.$refs.multipleTable.clearSelection()
}
</script>
<template>
  <div class="searchMetting">
    <BaseSearch :formItemList="formItemList" @search="search" />
    <TableList :tableColumnList="tableInfo.tableColumnList" :tableData="tableInfo.tableData" :pageNum="tableInfo.pageNum" :pageSize="tableInfo.pageSize" :dataTotal="tableInfo.dataTotal" :loading="tableInfo.loading" @handleSelectionChange="handleSelectionChange">
    </TableList>
  </div>
</template>
<style lang="scss" scoped>

</style>
